package com.example.app2.viewpager;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.example.app2.MainActivity3;
import com.example.app2.R;
import com.example.app2.weather.ListW;
import java.util.List;


public class ListAd extends BaseAdapter {
    Context mcontext;
    List<ListW> list;
    public ListAd(Context mcontext,List<ListW> list){
        this.mcontext = mcontext;
        this.list = list;
    }
    @Override
    public int getCount() {
        return MainActivity3.list.size();
    }


    @Override
    public Object getItem(int position) {
        return MainActivity3.list.get(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        View inflate = LayoutInflater.from(mcontext).inflate(R.layout.listview, null);
        TextView viewById = inflate.findViewById(R.id.t1);
        TextView viewById1 = inflate.findViewById(R.id.t2);
        TextView viewById2 = inflate.findViewById(R.id.t3);
        viewById.setText(list.get(position).maximum);
        viewById1.setText(list.get(position).minimun);
        viewById2.setText(list.get(position).status);
        return inflate;
    }
}
